package com.atguigu.gmall.user.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.user.entity.UserAddress;
import com.atguigu.gmall.user.service.UserAddressService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lhh
 * @ClassName UserRpcController
 * @date 2022 2022/12/23
 */
@RestController
@RequestMapping("/api/inner/rpc/user")
public class UserRpcController {

    @Resource
    UserAddressService userAddressService;

    @GetMapping("/getAddress/{userId}")
    public Result<List<UserAddress>> getUserAddress(@PathVariable("userId") Long userId) {
        List<UserAddress> userAddressList=userAddressService.getUserAddress(userId);
        return Result.ok(userAddressList);
    }
}
